package com.silverbox.shopper.mapper;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.silverbox.shopper.entity.CategoryGoodsDetail;
import com.silverbox.shopper.entity.extend.*;
import org.apache.ibatis.annotations.Param;

import com.silverbox.shopper.entity.Goods;
import com.silverbox.sweeporder.controller.index.vo.GoodsVO;

public interface GoodsMapper {
	int deleteByPrimaryKey(Integer id);

	int insert(Goods record);

	int insertSelective(Goods record);

	Goods selectByPrimaryKey(Integer id);

	int updateByPrimaryKeySelective(Goods record);

	int updateByPrimaryKeyWithBLOBs(Goods record);

	int updateByPrimaryKey(Goods record);

    int isEffectGoodsGroup(@Param("storeId")Integer storeId,@Param("shopperId")Integer shopperId);

	/* ============extend SQL=========================== */

    /**
     * 子账号下 扫码点餐类型菜谱
     * @param storeId
     * @param shopperId
     * @return
     */
    List<GoodsGroup> getEffsctGroupByStoreId(@Param("storeId") Integer storeId,@Param("shopperId")Integer shopperId);

    /**
     * 子账号下 全部类型菜谱
     * @param storeId
     * @param shopperId
     * @return
     */
    List<GoodsGroup> getDefaultGroupByStoreId(@Param("storeId") Integer storeId,@Param("shopperId")Integer shopperId);

    /**
     * 子账号 默认类型菜谱
     * @param storeId
     * @param shopperId
     * @return
     */
    List<GoodsGroup> getDefaultGroup(@Param("storeId") Integer storeId,@Param("shopperId")Integer shopperId);

    /**
     * 子账户下  菜谱详情
     * @return
     */
    List<CategoryGoods> getEffsctGoodsGroupByStoreId(GoodsGroupParam goodsGroupParam );

    /**
     * 主账号下  扫码点餐类型菜谱
     * @param shopperId
     * @return
     */
    List<GoodsGroup> getEffsctGroupByShopperId(@Param("storeId") Integer storeId,@Param("shopperId")Integer shopperId );

    /**
     * 主账号下  全部类型的菜谱
     * @param shopperId
     * @return
     */
    List<GoodsGroup> getDefaultEffsctGroupByShopperId(@Param("storeId") Integer storeId,@Param("shopperId")Integer shopperId);

    /**
     * 主账号下 菜谱详情
     * @return
     */
    List<CategoryGoods> getEffsctGoodsGroupByShopperId(GoodsGroupParam goodsGroupParam);


    /**
     * 查询默认规格的商品
     * @param
     * @return
     */
   /* List<CategoryGoods> getGoodsDefaultSize(GoodsExtendParam param);*/

	/**
	 * 查询商品（扫码下单使用）
	 * 
	 * @param param
	 * @return
	 */
	List<CategoryGoods> getCategoryGoods(GoodsExtendParam param);

    /**
     * 商品详情（查询默认规格）
     * @param storeId
     * @param goodsId
     * @return
     */
	List<CategoryGoodsDetail> getGoodsDetail(@Param("storeId") Integer storeId,@Param("goodsId")Integer goodsId );

	/**
	 * 获取打折商品列表
	 * 
	 * @param
	 * @return
	 */
	List<DiscountInfo> getDiscountInfoList(@Param("shopId") String shopId, @Param("goodsId") Integer goodsId,
			@Param("nowDate") String nowDate, @Param("dayTime") Integer dayTime);

	/**
	 * 根据店铺storeId和goodsId查询是否售罄
	 * 
	 * @param storeId
	 * @param goodsId
	 * @param startDate
	 * @param endDate
	 * @return
	 */
    List<Map<String,Object>> isSelloutByGoodsId(@Param("storeId") Integer storeId, @Param("goodsId") List<Integer> goodsId,
			@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("nowDate") String nowDate);

	/**
	 * 获取系统及商品信息
	 * 
	 * @return
	 */
	List<CategoryGoods> getSystemGoodsInfo(@Param("systemGoods") List<String> systemGoods);
	
	/**
	 * 获取必点菜商品信息
	 * @param
	 * @return
	 */
	List<CategoryGoods> getNeedGoodsInfoList(GoodsExtendParam param);

	/**
	 * 获取单个商品的基本商品信息
	 */
	List<CategoryGoods> getGoodsInfoByGoodsId(GoodsExtendParam goodsExtendParam);

	/**
	 * 获取店铺必选分类
	 * @param storeId
	 * @param shopperId
	 * @return
	 */
	List<RequiredCategory> getRequiredCategory(@Param("storeId") Integer storeId, @Param("shopperId") Integer shopperId,
			@Param("tableUid") String tableUid);
	
	/**
	 * 获取推荐菜
	 * @param shopperId
	 * @param storeId
	 * @param isFirstPay
	 * @return
	 */
	List<GoodsVO> getRecommendGoods(@Param("shopperId") Integer shopperId, @Param("storeId") Integer storeId, @Param("isFirstPay") Integer isFirstPay);
	
	/**
	 * 根据菜谱Id获取菜谱
	 * @param cookId
	 * @return
	 */
	List<GroupGoodsExtend> getGroupGoodsList(Integer cookId);
}